import {createApp} from 'vue'
import axios from './axios.js';
import router from './router/index.js';

import i18n, {language, messages} from './lang/index.js';

import Avue from 'components/avue/index.js';
import AvueExtension from 'components/avue-extension/index.js';
import 'components/avue/styles/index.scss';
import {getScreen} from 'utils/util.js'
import './permission';
import basicBlock from 'components/basic-block/main.vue'
import basicContainer from 'components/basic-container/main.vue'
import App from './App.vue'
import 'animate.css'
import dayjs from 'dayjs'
import 'styles/common.scss';
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as icons from '@element-plus/icons'
import startPanel from "components/start-panel/index.vue";

import pinia from "./stores";
import vueMonacoEditor from "components/vue-monaco-editor";

const app = createApp(App)
app.config.devtools = true;
app.use(i18n)
app.use(pinia)
Object.keys(icons).forEach(key => {
    app.component(key, icons[key])
})
//注册全局容器
app.component('basicContainer', basicContainer)
app.component('basicBlock', basicBlock)
app.component("start-panel", startPanel)

app.config.globalProperties.$dayjs = dayjs
app.config.globalProperties.getScreen = getScreen
app.use(vueMonacoEditor)

// app.use(error);

app.use(router, {pinia})


const elementPlusOption = {}
elementPlusOption.locale = messages[language]
app.use(ElementPlus, {
    locale: messages[language]
})
const avueOption = {}
avueOption.axios = axios;
avueOption.locale = messages[language];
avueOption.iconList = []

app.use(Avue, avueOption)
app.use(AvueExtension, avueOption)
// 屏蔽警告信息
app.config.warnHandler = () => null;
// app.config.errorHandler = () => null;
app.mount('#app')

